package ffmvc.model;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Set;

public class Performance {

	public Performance() {
	}

	public Performance(Performance perf) {
		this.season = perf.getSeason();
		this.cornersWon = perf.getCornersWon();
		this.id = perf.getId();
		this.points = perf.getPoints();
		this.week = perf.getWeek();
		this.playerId = perf.getPlayerId();
		this.assists = perf.getAssists();
		this.goalsAllowed = perf.getGoalsAllowed();
		this.foulsWon = perf.getFoulsWon();
		this.averagePoints = perf.getAveragePoints();
		this.blockedShots = perf.getBlockedShots();
		this.cleanSheet = perf.getCleanSheet();
		this.crosses = perf.getCrosses();
		this.defeat = perf.getDefeat();
		this.foulsCommitted = perf.getFoulsCommitted();
		this.foulsWon = perf.getFoulsWon();
		this.foulsWonCommittedRatio = perf.getFoulsWonCommitedRatio();
		this.gamesPlayed = perf.getGamesPlayed();
		this.give = perf.getGive();
		this.goals = perf.getGoals();
		this.goalsAllowed = perf.getGoalsAllowed();
		this.matchWinningGoal = perf.getMatchWinningGoal();
		this.owned = perf.getOwned();
		this.ownGoals = perf.getOwnGoals();
		this.passessIntercepted = perf.getPassessIntercepted();
		this.penaltiesCommitted = perf.getPenaltiesCommitted();
		this.penaltyKickGoals = perf.getPenaltyKickGoals();
		this.penaltyKickMisses = perf.getPenaltyKickGoals();
		this.penaltyKickSaves = perf.getPenaltyKickSaves();
		this.redCard = perf.getRedCard();
		this.salaryReal = perf.getSalaryReal();
		this.saves = perf.getSaves();
		this.setPieceGoals = perf.getSetPieceGoals();
		this.shotsOnTarget = perf.getShotsOnTarget();
		this.tacklesWon = perf.getTacklesWon();
		this.tie = perf.getTie();
		this.win = perf.getWin();
		this.yellowCards = perf.getYellowCards();
		// user objects
		this.player = perf.getPlayer();
		this.games = perf.getGames();

	}

	private String season;

	private String cornersWon;

	private String id;

	private Double points;

	private Integer week;

	private String playerId;

	private Player player;

	private String teamId;

	private Set<Game> games;

	private Integer assists;

	private Integer goalsAllowed;

	private Integer foulsWon;

	private Integer yellowCards;

	private Integer penaltyKickGoals;

	private Integer foulsCommitted;

	private Integer matchWinningGoal;

	private Integer blockedShots;

	private Integer penaltyKickSaves;

	private Integer tacklesWon;

	private Integer give;

	private Integer penaltiesCommitted;

	private Integer shotsOnTarget;

	private Integer redCard;

	private Integer passessIntercepted;

	private Integer penaltyKickMisses;

	private Integer goals;

	private Integer gamesPlayed;

	private Integer defeat;

	private Integer tie;

	private Integer win;

	private Integer cleanSheet;

	private Integer ownGoals;

	private Integer setPieceGoals;

	private Integer saves;

	private Integer crosses;

	private Double salaryReal;

	private Double owned;

	private Double foulsWonCommittedRatio;

	private Double averagePoints;

	public String getSeason() {
		return season;
	}

	public void setSeason(String season) {
		this.season = season;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Double getPoints() {
		return points;
	}

	public void setPoints(Double points) {
		this.points = points;
	}

	public String getPlayerId() {
		return playerId;
	}

	public void setPlayerId(String playerId) {
		this.playerId = playerId;
	}

	public String getTeamId() {
		if (teamId == null) {
			this.setTeamId(player.getTeamId());
		}
		return teamId;
	}

	public void setTeamId(String teamId) {
		this.teamId = teamId;
	}

	public Integer getAssists() {
		return assists;
	}

	public void setAssists(Integer assists) {
		this.assists = assists;
	}

	public Integer getGoalsAllowed() {
		return goalsAllowed;
	}

	public void setGoalsAllowed(Integer goalsAllowed) {
		this.goalsAllowed = goalsAllowed;
	}

	public Integer getFoulsWon() {
		return foulsWon;
	}

	public void setFoulsWon(Integer foulsWon) {
		this.foulsWon = foulsWon;
	}

	public Integer getYellowCards() {
		return yellowCards;
	}

	public void setYellowCards(Integer yellowCards) {
		this.yellowCards = yellowCards;
	}

	public Integer getPenaltyKickGoals() {
		return penaltyKickGoals;
	}

	public void setPenaltyKickGoals(Integer penaltyKickGoals) {
		this.penaltyKickGoals = penaltyKickGoals;
	}

	public Integer getFoulsCommitted() {
		return foulsCommitted;
	}

	public void setFoulsCommitted(Integer foulsCommitted) {
		this.foulsCommitted = foulsCommitted;
	}

	public Integer getMatchWinningGoal() {
		return matchWinningGoal;
	}

	public void setMatchWinningGoal(Integer matchWinningGoal) {
		this.matchWinningGoal = matchWinningGoal;
	}

	public Integer getBlockedShots() {
		return blockedShots;
	}

	public void setBlockedShots(Integer blockedShots) {
		this.blockedShots = blockedShots;
	}

	public Integer getPenaltyKickSaves() {
		return penaltyKickSaves;
	}

	public void setPenaltyKickSaves(Integer penaltyKickSaves) {
		this.penaltyKickSaves = penaltyKickSaves;
	}

	public Integer getTacklesWon() {
		return tacklesWon;
	}

	public void setTacklesWon(Integer tacklesWon) {
		this.tacklesWon = tacklesWon;
	}

	public Integer getGive() {
		return give;
	}

	public void setGive(Integer give) {
		this.give = give;
	}

	public Integer getShotsOnTarget() {
		return shotsOnTarget;
	}

	public void setShotsOnTarget(Integer shotsOnTarget) {
		this.shotsOnTarget = shotsOnTarget;
	}

	public Integer getRedCard() {
		return redCard;
	}

	public void setRedCard(Integer redCard) {
		this.redCard = redCard;
	}

	public Integer getPassessIntercepted() {
		return passessIntercepted;
	}

	public void setPassessIntercepted(Integer passessIntercepted) {
		this.passessIntercepted = passessIntercepted;
	}

	public Integer getPenaltyKickMisses() {
		return penaltyKickMisses;
	}

	public void setPenaltyKickMisses(Integer penaltyKickMisses) {
		this.penaltyKickMisses = penaltyKickMisses;
	}

	public Integer getGoals() {
		return goals;
	}

	public void setGoals(Integer goals) {
		this.goals = goals;
	}

	public Integer getGamesPlayed() {
		return gamesPlayed;
	}

	public void setGamesPlayed(Integer gamesPlayed) {
		this.gamesPlayed = gamesPlayed;
	}

	public Integer getDefeat() {
		return defeat;
	}

	public void setDefeat(Integer defeat) {
		this.defeat = defeat;
	}

	public Integer getTie() {
		return tie;
	}

	public void setTie(Integer tie) {
		this.tie = tie;
	}

	public Integer getWin() {
		return win;
	}

	public void setWin(Integer win) {
		this.win = win;
	}

	public Integer getCleanSheet() {
		return cleanSheet;
	}

	public void setCleanSheet(Integer cleanSheet) {
		this.cleanSheet = cleanSheet;
	}

	public Integer getOwnGoals() {
		return ownGoals;
	}

	public void setOwnGoals(Integer ownGoals) {
		this.ownGoals = ownGoals;
	}

	public Integer getSetPieceGoals() {
		return setPieceGoals;
	}

	public void setSetPieceGoals(Integer setPieceGoals) {
		this.setPieceGoals = setPieceGoals;
	}

	public Integer getSaves() {
		return saves;
	}

	public void setSaves(Integer saves) {
		this.saves = saves;
	}

	public Integer getCrosses() {
		return crosses;
	}

	public void setCrosses(Integer crosses) {
		this.crosses = crosses;
	}

	public Double getSalaryReal() {
		return salaryReal;
	}

	public void setSalaryReal(Double salaryReal) {
		this.salaryReal = salaryReal;
	}

	public Double getOwned() {
		return owned;
	}

	public void setOwned(Double owned) {
		this.owned = owned;
	}

	public Integer getWeek() {
		return week;
	}

	public void setWeek(Integer week) {
		this.week = week;
	}

	public Player getPlayer() {
		return player;
	}

	public void setPlayer(Player player) {
		this.player = player;
	}

	public Double getFoulsWonCommitedRatio() {
		if (this.foulsWonCommittedRatio == null) {
			if (this.foulsCommitted == 0) {
				this.foulsWonCommittedRatio = null;

			} else {
				Double ratio = (double) (this.foulsWon / this.foulsCommitted);
				BigDecimal bd = new BigDecimal(ratio).setScale(2, RoundingMode.HALF_EVEN);
				ratio = bd.doubleValue();
				this.foulsWonCommittedRatio = ratio;
			}
		}
		return this.foulsWonCommittedRatio;
	}

	public Double getAveragePoints() {
		if (this.averagePoints == null) {
			if (this.gamesPlayed == 0) {
				this.averagePoints = null;

			} else {
				Double ratio = (double) (this.points / this.gamesPlayed);
				BigDecimal bd = new BigDecimal(ratio).setScale(2, RoundingMode.HALF_EVEN);
				ratio = bd.doubleValue();
				this.averagePoints = ratio;
			}
		}
		return this.averagePoints;
	}

	public Integer getPenaltiesCommitted() {
		return penaltiesCommitted;
	}

	public void setPenaltiesCommitted(Integer penaltiesCommitted) {
		this.penaltiesCommitted = penaltiesCommitted;
	}

	public String getCornersWon() {
		return cornersWon;
	}

	public void setCornersWon(String cornersWon) {
		this.cornersWon = cornersWon;
	}

	public Set<Game> getGames() {
		return games;
	}

	public void setGames(Set<Game> games) {
		this.games = games;
	}

}
